Skip to content

✨ feat: Better size display#824

Closed
kalicyh wants to merge 1 commit intoM2Team:mainfrom
kalicyh:main
Closed

✨ feat: Better size display#824
kalicyh wants to merge 1 commit intoM2Team:mainfrom
kalicyh:main

Conversation

@kalicyh
Copy link

@kalicyh kalicyh commented Feb 6, 2026

Add a switch for better display size
Resolve #616
image
image

@MouriNaruto
Copy link
Member

The pull request title and content should not have any prefix, emojis (the AI/LLM smell) and non-English contents.

Kenji Mouri

@MouriNaruto
Copy link
Member

Also, we should make the least intrusive modifications (a.k.a. introducing as least modification mark as possible) to the inherited 7-Zip codebase. And reuse the functions from Project Mile libraries like https://github.com/ProjectMile/Mile.Windows.Helpers/tree/main/Mile.Helpers, which is referenced by NanaZip.

Kenji Mouri

@MouriNaruto
Copy link
Member

According to two issues, I think you should rebase your implementation hand by hand (the commit descriptions should also be changed), and change the pull request title.

Kenji Mouri

@MouriNaruto MouriNaruto marked this pull request as draft February 6, 2026 08:16
@kalicyh
Copy link
Author

kalicyh commented Feb 6, 2026

According to two issues, I think you should rebase your implementation hand by hand (the commit descriptions should also be changed), and change the pull request title.

Kenji Mouri

I’m unable to directly edit the current PR title. Would it be possible for you to help update it, or should I open a new PR instead?

I have already cleaned up the commit messages to remove the previous prefixes/emojis/non-English content, and I have also adjusted the code according to your suggestions.

Thank you for your guidance.

@MouriNaruto
Copy link
Member

MouriNaruto commented Feb 6, 2026

Your code implementation still has issues. I think it's time to close the issue.

Do not be lazy, use Visual Studio (not Code) to edit, build, and debug. Also, read the commits history for NanaZip first and learn how to write a proper commit description.

Also, at least learn from

std::wstring ConvertByteSizeToString(
std::uint64_t ByteSize)
{
const wchar_t* Units[] =
{
L"Byte",
L"Bytes",
L"KiB",
L"MiB",
L"GiB",
L"TiB",
L"PiB",
L"EiB"
};
const std::size_t UnitsCount = sizeof(Units) / sizeof(*Units);
// Output Format:
// For ByteSize is 0 or 1: x Byte
// For ByteSize is from 2 to 1023: x Bytes
// For ByteSize is larger than 1023: x.xx {KiB, MiB, GiB, TiB, PiB, EiB}
std::size_t UnitIndex = 0;
double Result = static_cast<double>(ByteSize);
if (ByteSize > 1)
{
for (UnitIndex = 1; UnitIndex < UnitsCount; ++UnitIndex)
{
if (1024.0 > Result)
break;
Result /= 1024.0;
}
// Keep two digits after the decimal point.
Result = static_cast<std::uint64_t>(Result * 100) / 100.0;
}
return Mile::FormatWideString(
(UnitIndex > 1) ? L"%.2f %s" : L"%.0f %s",
Result,
Units[UnitIndex]);
}
.

I also don't want to mention the code style issues again. (Also, I searched the NanaZip's Pull Request history, some guy did a same feature, but he chose to be lazy. It's not acceptable.)

You must read https://github.com/M2Team/NanaZip/blob/main/CONTRIBUTING.md carefully.

And you must write your final commit with the required coding style without AI/LLM before you making that online. It's important for acceptable code quality to help for the future maintenance.

Kenji Mouri

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

希望增加智能显示文件大小单位,或用户自己选择文件大小单位的功能

2 participants